/*
 * 基础父类
 * @author li.xiaomei
 * @date 2016-09-29
 */

var SuperClass = (function() {

  var _mix = function(r, s) {
    for (var p in s) {
      if (s.hasOwnProperty(p)) {
        r[p] = s[p];
      }
    }
  };

  var _extend = function() {
    var prototype = new this();

    var items = Array.prototype.slice.call(arguments) || [];
    var item;
    while (item = items.shift()) {
      _mix(prototype, item.prototype || item);
    }

    function SubClass() {
      if (this.init) {
        this.init.apply(this, arguments);
      }
    }
    SubClass.prototype = prototype;
    SubClass.prototype.constructor = SubClass;
    SubClass.extend = _extend;

    return SubClass;
  };

  var SuperClass = function() {};
  SuperClass.extend = _extend;

  return SuperClass;
}());

module.exports = SuperClass;
